package com.dcy.daily.skill.rabbitMQ.springAMQP.tmp.helloword;

import com.dcy.daily.common.config.annotation.ComponentUtil;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

/**
 * 使用AmqpTemplate来发送消息
 * @author duanchunyu
 * @version 1.0.0
 * @createTime 2021年07月22日 11:12
 */
@ComponentUtil.CComponent
public class Send implements ApplicationRunner {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        amqpTemplate.convertAndSend("myqueue","foo");
    }
}
